"use strict";
cc._RF.push(module, '55cdbUdSaNNaqWUdZx+xknk', 'NodeUtil');
// eazax-ccc/utils/NodeUtil.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 节点工具
 * @see NodeUtil.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/utils/NodeUtil.ts
 */
var NodeUtil = /** @class */ (function () {
    function NodeUtil() {
    }
    /**
     * 获取节点在目标节点（容器）下的相对位置
     * @param node 节点
     * @param container 目标节点（容器）
     */
    NodeUtil.getRelativePosition = function (node, container) {
        var worldPos = (node.getParent() || node).convertToWorldSpaceAR(node.getPosition());
        return container.convertToNodeSpaceAR(worldPos);
    };
    /**
     * 坐标是否在目标节点范围内
     * @param pos 坐标
     * @param target 目标节点
     */
    NodeUtil.isPosOnNodeRect = function (pos, target) {
        var rect = target.getBoundingBoxToWorld();
        return rect.contains(pos);
    };
    /**
     * 两个节点是否重叠
     * @param node1 节点 1
     * @param node2 节点 2
     * @param contains 是否完全包含
     */
    NodeUtil.areNodesOverlap = function (node1, node2, contains) {
        if (contains === void 0) { contains = false; }
        var rect2 = node2.getBoundingBoxToWorld();
        var rect1 = node1.getBoundingBoxToWorld();
        return contains ? rect2.containsRect(rect1) : rect2.intersects(rect1);
    };
    return NodeUtil;
}());
exports.default = NodeUtil;

cc._RF.pop();